<?php


namespace App\Services\Other\Models;

use App\Services\Business\Models\Base;
use App\Services\Business\Models\VideoRecord;
use App\Services\Member\Models\User;
use App\Services\Business\Models\Photo;
use Illuminate\Database\Eloquent\Relations\MorphToMany;


class Fragment extends Base
{


    protected $table = 'conquer_fragments';

    protected $fillable = [
        'user_id', 'conquer_id','title','measure','balance_measure'
    ];


    public function photos()
    {
        return $this->morphMany(Photo::class, 'photoable');

    }

    public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }

    public function conquer()
    {
        return $this->belongsTo(Conquer::class, 'conquer_id');
    }
    /**
     * @return MorphToMany
     */
    public function videos()
    {
        return $this->morphToMany(VideoRecord::class, 'video_recordable');
    }

    public function members()
    {

        return $this->belongsToMany(User::class, 'user_conquer','conquer_id','user_id');
    }



}
